import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'fcl_bmf_platform_interface.dart';

const String kNativeChannelName = 'com.nd.fc_lbs.fc_lbs_channel';

/// An implementation of [FclBmfPlatformInterface] that uses method channels.
class FclBmfMethodChannelInterface extends FclBmfPlatformInterface {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  static const MethodChannel methodChannel = MethodChannel(kNativeChannelName);

  @override
  Future<String?> getPlatformVersion() async {
    final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
    return version;
  }

  @override
  Future<String?> getAppIdentifier() async {
    final result = await methodChannel.invokeMethod<String>('getAppIdentifier');
    return result;
  }

  @override
  Future<String?> requestPermission() async {
    final result = await methodChannel.invokeMethod<String>('requestPermission');
    return result;
  }

  @override
  Future<bool> setAK(String ak) async {
    final result = await methodChannel.invokeMethod<bool>('setAK', ak);
    return result ?? false;
  }

  @override
  Future<bool> setAgreePrivacy(bool agree) async {
    final result = await methodChannel.invokeMethod<bool>('setAgreePrivacy', agree);
    return result ?? false;
  }

  @override
  Future<String> startLocation() async {
    final result = await methodChannel.invokeMethod<String>('startLocation');
    return result ?? '';
  }

  @override
  Future<bool> stopLocation() async {
    final result = await methodChannel.invokeMethod<bool>('stopLocation');
    return result ?? false;
  }

  @override
  Future<bool> flutterToOhosByMapPage() async {
    final result = await methodChannel.invokeMethod<bool>('flutterToOhosByMapPage');
    return result ?? false;
  }

}
